package cn.hackcloud.mutithread.domain;

public class ResultVo {

	public static void main(String[] args) {
		LockDemo demo = new LockDemo();
		for (int i = 0; i < 5; i++) {
			new Thread(new Runnable() {

				@Override
				public void run() {
					demo.set("666");
				}
			}, "test").start();
		}
	}
}

class LockDemo extends BaseVo {
	public synchronized void set(String key) {
		if (map.containsKey(key)) {
			System.out.println("ok");
		} else {
			map.put(key, "1");
			System.out.println("no");
		}
	}
}
